|
Neurosis Engine
|
00001 00002 // Neurosis Engine - LP23.com 00003 // Copyright © Luigi Pino. All rights reserved. 00004 00005 /***************************************************************************/ 00006 00007 #ifndef _NEUROSIS_ENGINE_NETWORK_H_ 00008 #define _NEUROSIS_ENGINE_NETWORK_H_ 00009 00010 /***************************************************************************/ 00011 00012 //------------------------------------------------ 00013 #define NETWORK_BUFFER 4096 00014 //------------------------------------------------ 00015 00016 /***************************************************************************/ 00017 00020 class CNeurosisNetwork { 00021 public: 00022 CNeurosisNetwork(int maxConnections, int bufferSize); 00024 ~CNeurosisNetwork(); 00025 00027 char* Buffer_Retrieve(int iConnection); 00029 void Buffer_Store(int iConnection, char *data); 00031 bool Check_For_Clients(int iConnection); 00033 int Close_Socket(int iConnection); 00035 bool Connect_To_Server(int iConnection, char *ip, int portNumber, bool isIPAddress); 00037 int Get_Socket(int iConnection); 00039 bool Initialize_Server(int iConnection, int portNumber); 00041 bool In_Use(int iConnection); 00043 int Recv(int iConnection, char *data, bool blocking); 00045 bool Recv_File(int iConnection, char *filename); 00047 void Recv_String(int iConnection); 00049 int Send(int iConnection, char *data, int dataSize, bool sendImmediately); 00051 bool Send_File(int iConnection, char *filename); 00053 void Send_String(int iConnection); 00054 00055 private: 00056 struct CNetworkData { 00057 char *pBuffer; 00058 bool mInUse; 00059 sockaddr_in mAddress; 00060 unsigned int mSocket; 00061 }; 00062 00063 CNetworkData *pNetwork; 00064 int mBufferSize; 00065 int mMaxConnections; 00066 }; 00067 00068 /***************************************************************************/ 00069 #endif
1.7.6.1